package com.yhsoft.sys.controller;

import com.yhsoft.common.vo.Result;
import com.yhsoft.sys.controller.Response.SysContentOutVo;
import com.yhsoft.sys.controller.Response.SystemSearchOutVo;
import com.yhsoft.sys.controller.request.SysContentInVo;
import com.yhsoft.sys.controller.request.SystemSearchInVo;
import com.yhsoft.sys.service.ICompanyInfoService;
import com.yhsoft.sys.service.ISysContentService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;

/**
 * <p>
 * 平台内容配置 前端控制器
 * </p>
 *
 * @author yyyyyyyh
 * @since 2023-11-20
 */
@Api(tags = {"K-平台首页接口列表"})
@RestController
@RequestMapping("/sys/index")
public class SystemController {

    @Autowired
    private ICompanyInfoService iCompanyInfoService;

    @ApiOperation("渠道商关键词联想")
    @GetMapping("/think")
    public Result<?> think(@RequestParam(required = false) String companyName) {
        ArrayList<String> list = iCompanyInfoService.think(companyName);
        return Result.success(list);
    }

    @ApiOperation("今日统计数据")
    @PostMapping("/search")
    public Result<SystemSearchOutVo> search(@RequestBody SystemSearchInVo inVo) {
        SystemSearchOutVo outVo = iCompanyInfoService.getTodayCountData(inVo);
        return Result.success(outVo);
    }

    @ApiOperation("统计数据")
    @GetMapping("/getCount")
    public Result<SystemSearchOutVo> getCount() {
        SystemSearchOutVo outVo = iCompanyInfoService.getAllCountData();
        return Result.success(outVo);
    }
}
